#define DEBUG
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long ll;

const int maxn=100000;

class Ele {
public:
  int v, id;

  static bool cmp(Ele &a, Ele &b) {
    return a.v<b.v;
  }
};

class TreeArray {
public:
  int a[maxn+1], n;

  int lowbit(int x) {
    return x&(-x);
  }

  void add(int o, int v) {
    for (; o<=n; o+=lowbit(o)) {
      a[o] += v;
    }
  }

  int get(int o) {
    int ret=0;
    for (; o>0; o-=lowbit(o)) {
      ret += a[o];
    }
    return ret;
  }
};

int main() {
  freopen("haircut.in", "r", stdin);
  freopen("haircut.out", "w", stdout);

  static Ele a[maxn+1];
  int n;
  scanf("%d", &n);
  for (int i=1; i<=n; i++) {
    scanf("%d", &a[i].v);
    a[i].id = i;
  }
  sort(a+1, a+n+1, Ele::cmp);

  static TreeArray sum;
  sum.n = n;
  static ll ans[maxn+1];
  for (int i=n, j; i>0; i=j) {
    for (j=i; j>0 && a[j].v==a[i].v; j--) {
      ans[a[i].v] += sum.get(a[j].id);
    }
    for (j=i; j>0 && a[j].v==a[i].v; j--) {
      sum.add(a[j].id, 1);
    }
  }
  for (int i=n; i>0; i--) {
    ans[i-1] += ans[i];
  }

  for (int i=0; i<n; i++) {
    printf("%lld\n", ans[0]-ans[i]);
  }

  fclose(stdin);
  fclose(stdout);
  return 0;
}
